/*! ******************************************************************************
 *
 * Created on 2022-08-01
 *
 * Copyright(c) YuZhou Big Data Laboratory CO.,Ltd, 2022.  All rights reserved.
 *
 *******************************************************************************
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 ******************************************************************************/
package org.pentaho.di.ui.core.enums;

/**
 * @author yzbdl@yzbdl.ac.cn
 * @version: 1.0
 * @Date 2020/6/10 11:13
 **/
public enum PluginType {

    Step("转换","Step"),
    JobEntry("作业","JobEntry"),
    CarteServlet("Carte服务","CarteServlet"),
    DatabaseMetaPlugin("数据库插件","DatabaseMetaPlugin"),
    RepositoryPlugin("资源库插件","RepositoryPlugin"),
    CompressionPlugin("压缩工具","CompressionPlugin"),

    ;


    /**
     *
     */
    public String pluginName;

    /**
     * 插件code
     */
    public String pluginCode;

    /**
     *
     * @param pluginName
     * @param pluginCode
     */
    PluginType(String pluginName, String pluginCode) {
        this.pluginName = pluginName;
        this.pluginCode = pluginCode;
    }

    public String getPluginName() {
        return pluginName;
    }

    public String getPluginCode() {
        return pluginCode;
    }
    public static PluginType getByName(String name) {
        for (PluginType type : PluginType.values()) {
            if (type.pluginName.equals(name)) {
                return type;
            }
        }
        return null;
    }

    public static PluginType getByCode(String code) {
        for (PluginType type : PluginType.values()) {
            if (type.pluginCode.equals(code)) {
                return type;
            }
        }
        return null;
    }
}
